#include <iostream>
#include <exception>
#include <memory>


using namespace std;

class test{
public:
    test(){
        cout << "test construct" << endl;
    }
    ~test(){
        cout << "test destruct" << endl;
    }
};

class A{
public:
    A(): t(){
        try{
            throw exception();
        }
        catch(exception b){
            cout << b.what() << endl;
            throw;
        }
    }
    ~A(){
        cout << "destroy the obj" << endl;
    }

    void print(){
        cout << "hello world" << endl;
    }
private:
    test t;
};

class t{
public:
    t(){
        cout << "t construct" << endl;
    }
    ~t(){
        cout << "t destruct" << endl;
    }
};

class B{
public:
    B():tmp(),aaa(){
    }
private:
    t tmp;
    A aaa;
};

class C{
public:
    ~C(){
        try{
            throw exception();
        }
        catch(exception& a){
            cout << "some error happen, do you want to quit?" << endl;
            char c;
            cin >> c;
            if(c == 'y'){
                exit(1);
            }
        }
    }
};


int main(){

    // try
    // {
    //     B c;
    // }
    // catch(const std::exception& e)
    // {
    //     std::cerr << e.what() << '\n';
    // }
    C c;
    

    
    cout << "end of proc" << endl;
}